package com.zhang;

import lombok.Getter;

public enum CountryEnum {
    //枚举
    ONE(1,"齐"),TWO(2,"楚"),THREE(3,"燕"),FOUR(4,"韩"),FIVE(5,"赵"),SIX(6,"魏");

    @Getter
    private Integer retCode;
    @Getter
    private String retMessage;

    CountryEnum(Integer retCode, String retMessage){
        this.retCode = retCode;
        this.retMessage = retMessage;
    }

    public static CountryEnum getCountry(int index){
        CountryEnum[] array = CountryEnum.values();
        for (CountryEnum element: array ) {
            if (element.getRetCode() == index){
                return  element;
            }
        }
        return null;
    }

}
